package redisson.rest.stream;

import java.util.Map;

import org.redisson.api.RReliableTopic;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
public class RReliableTopicConsumer implements SmartInitializingSingleton {

	@Autowired
	RedissonClient redissonClient;

	@Override
	public void afterSingletonsInstantiated() {
		////////////////////// 必须先配置监听//////////////////////
		log.info("### 监听redisson消息,启动成功,,, ");
//		RReliableTopic reliableTopic = redissonClient.getReliableTopic("test:reliabletopic:axxc");
//		reliableTopic.addListener(Map.class, (channel, msg) -> {
//			log.info(">>>> 收到 channel={} msg={}", channel, msg);
//		});
		log.info("### 模式订阅已建立");

	}

}
